package com.myjob.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author chenyuan
 * @date 2021/3/2 22:22
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Autowired
    private webProperties webProperties;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler(webProperties.getPrefixPath()+"**").addResourceLocations("/", "classpath:/static/");
        registry.addResourceHandler("classpath:/static/**").addResourceLocations("/", "classpath:/static/");
        registry.addResourceHandler("classpath:/META-INF/resources/**").addResourceLocations("/", "classpath:/static/");
        registry.addResourceHandler("classpath:/resources/**").addResourceLocations("/", "classpath:/static/");
        registry.addResourceHandler("classpath:/public/**").addResourceLocations("/", "classpath:/static/");
//        registry.addResourceHandler("/file/static/*").addResourceLocations("file:E:\\springboot\\");
    }

}
